package com.yunmang.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.yunmang.R;
import com.yunmang.fragment.BaseFragment;
import com.yunmang.fragment.ServiceFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者 : bean on 2017/4/6/0006.
 * 注释 :
 */
public class MyItemPagerAdapter extends PagerAdapter {
    private List<Integer> list = new ArrayList<>();
    private Context _context;

    public MyItemPagerAdapter(Context context, List<Integer> list) {
        this.list = list;
        this._context = context;
    }

    @Override
    public int getCount() {
        return 5;
    }

    @Override
    public boolean isViewFromObject(View view, Object o) {
        return view == o;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ImageView view = new ImageView(_context);
        view.setScaleType(ImageView.ScaleType.FIT_XY);
            view.setImageResource(R.mipmap.banner);

//        Glide.with(_context).load(list.get(position)).into(view);
        container.addView(view);
        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }
}
